<html>
<head><meta charset="utf-8"><title>custom rustfmt · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html">custom rustfmt</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="205929359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/custom%20rustfmt/near/205929359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html#205929359">(Aug 04 2020 at 16:34)</a>:</h4>
<p>I'm seeing these errors when editing compiler and trying to use the compiler's rustfmt:</p>
<blockquote>
<p>[Error - 12:33:50 PM] Request textDocument/formatting failed.<br>
  Message: No such file or directory (os error 2)<br>
  Code: -32603 </p>
</blockquote>



<a name="205929615"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/custom%20rustfmt/near/205929615" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html#205929615">(Aug 04 2020 at 16:37)</a>:</h4>
<p>Hm, is the custom <code>rustfmt</code> there? "No such file or directory" often happens when you <em>execute</em> something which doesn't exist.</p>



<a name="205929678"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/custom%20rustfmt/near/205929678" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html#205929678">(Aug 04 2020 at 16:37)</a>:</h4>
<p>Wouldn't it be awesome if <code>std::io::Error</code> actually said <em>which path</em> is wrong :-D We need to add some anyhow::context somewhere I guess....</p>



<a name="205933128"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/custom%20rustfmt/near/205933128" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html#205933128">(Aug 04 2020 at 17:09)</a>:</h4>
<p>Try <code>strace -etrace=%process -fp $PID_OF_RA</code></p>



<a name="206004452"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/custom%20rustfmt/near/206004452" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html#206004452">(Aug 05 2020 at 09:46)</a>:</h4>
<p>the file is there, yes</p>



<a name="206004469"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/custom%20rustfmt/near/206004469" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html#206004469">(Aug 05 2020 at 09:46)</a>:</h4>
<p>but maybe the <em>relative path</em> is causing problems</p>



<a name="206004498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/custom%20rustfmt/near/206004498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html#206004498">(Aug 05 2020 at 09:46)</a>:</h4>
<p>some more context:</p>
<div class="codehilite"><pre><span></span><code>athena. <span class="nb">pwd</span>
/home/nmatsakis/versioned/rust-1
athena. cat .vscode/settings.json
<span class="o">{</span>
  <span class="s2">&quot;rust-analyzer.checkOnSave.overrideCommand&quot;</span>: <span class="o">[</span>
    <span class="s2">&quot;./x.py&quot;</span>,
    <span class="s2">&quot;check&quot;</span>,
    <span class="s2">&quot;--json-output&quot;</span>
  <span class="o">]</span>,
  <span class="s2">&quot;rust-analyzer.rustfmt.overrideCommand&quot;</span>: <span class="o">[</span>
    <span class="s2">&quot;./build/x86_64-unknown-linux-gnu/stage0/bin/rustfmt&quot;</span>
  <span class="o">]</span>,
  <span class="s2">&quot;editor.formatOnSave&quot;</span>: <span class="nb">true</span>
<span class="o">}</span>
athena. ls <span class="s2">&quot;./build/x86_64-unknown-linux-gnu/stage0/bin/rustfmt&quot;</span>
./build/x86_64-unknown-linux-gnu/stage0/bin/rustfmt
</code></pre></div>



<a name="206004512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/custom%20rustfmt/near/206004512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html#206004512">(Aug 05 2020 at 09:47)</a>:</h4>
<p>I can try strace</p>



<a name="206004522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/custom%20rustfmt/near/206004522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html#206004522">(Aug 05 2020 at 09:47)</a>:</h4>
<p>though I'm not sure which PID to use :)</p>



<a name="206004617"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/custom%20rustfmt/near/206004617" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html#206004617">(Aug 05 2020 at 09:48)</a>:</h4>
<p>hmm I didn't see anything from strace</p>



<a name="206004636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/custom%20rustfmt/near/206004636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html#206004636">(Aug 05 2020 at 09:49)</a>:</h4>
<p>ah, yeah, you need to use a relative path now</p>



<a name="206004641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/custom%20rustfmt/near/206004641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html#206004641">(Aug 05 2020 at 09:49)</a>:</h4>
<p>ah now I did</p>



<a name="206004643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/custom%20rustfmt/near/206004643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html#206004643">(Aug 05 2020 at 09:49)</a>:</h4>
<p>err, absolute</p>



<a name="206004654"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/custom%20rustfmt/near/206004654" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html#206004654">(Aug 05 2020 at 09:49)</a>:</h4>
<p>oh ok</p>



<a name="206004657"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/custom%20rustfmt/near/206004657" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html#206004657">(Aug 05 2020 at 09:49)</a>:</h4>
<p>we should fix that...</p>



<a name="206004664"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/custom%20rustfmt/near/206004664" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html#206004664">(Aug 05 2020 at 09:49)</a>:</h4>
<p>Ah yeah.... the relative path might be a culprit, we absolutize them relative to worspace root URI, and I am not sure what's that URI would be for VS Code</p>



<a name="206004665"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/custom%20rustfmt/near/206004665" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html#206004665">(Aug 05 2020 at 09:49)</a>:</h4>
<p>...and/or update rustc-dev-guide :)</p>



<a name="206004674"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/custom%20rustfmt/near/206004674" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html#206004674">(Aug 05 2020 at 09:49)</a>:</h4>
<p>fix = better of course</p>



<a name="206004716"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/custom%20rustfmt/near/206004716" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html#206004716">(Aug 05 2020 at 09:50)</a>:</h4>
<p>I at least have a lot of checkouts so it's nice for it to be relative</p>



<a name="206004723"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/custom%20rustfmt/near/206004723" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html#206004723">(Aug 05 2020 at 09:50)</a>:</h4>
<p><span class="user-mention silent" data-user-id="133169">matklad</span> <a href="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/custom.20rustfmt/near/206004664">said</a>:</p>
<blockquote>
<p>Ah yeah.... the relative path might be a culprit, we absolutize them relative to worspace root URI, and I am not sure what's that URI would be for VS Code</p>
</blockquote>
<p>but this seems like the behavior I wnt</p>



<a name="206004829"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/custom%20rustfmt/near/206004829" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html#206004829">(Aug 05 2020 at 09:51)</a>:</h4>
<p>still, strace output:</p>
<div class="codehilite"><pre><span></span><code>[pid  7781] execve(&quot;./build/x86_64-unknown-linux-gnu/stage0/bin/rustfmt&quot;, [&quot;./build/x86_64-unknown-linux-gnu&quot;...], 0x55a7d3de7b80 /* 51 vars */) = -1 ENOENT (No such file or direc
</code></pre></div>



<a name="206004861"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/custom%20rustfmt/near/206004861" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html#206004861">(Aug 05 2020 at 09:51)</a>:</h4>
<p>thanks all</p>



<a name="206004961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/custom%20rustfmt/near/206004961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html#206004961">(Aug 05 2020 at 09:53)</a>:</h4>
<p>Yeah, I'll try to look at it today... maybe -- been busy this week, and I have vacation starting tomorrow :D</p>



<a name="206005075"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/custom%20rustfmt/near/206005075" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html#206005075">(Aug 05 2020 at 09:55)</a>:</h4>
<p>no stress..</p>



<a name="206007025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/custom%20rustfmt/near/206007025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html#206007025">(Aug 05 2020 at 10:24)</a>:</h4>
<p>And <code>ls /proc/7781/cwd/build/x86_64-unknown-linux-gnu/stage0/bin/rustfmt</code>?</p>



<a name="206009613"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/custom%20rustfmt/near/206009613" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html#206009613">(Aug 05 2020 at 11:07)</a>:</h4>
<p>I guess, I've found the explanation: <a href="https://github.com/oconnor663/duct.rs/blob/17e30e83a16b202551df4d70d0b2cc174cb53e5d/src/lib.rs#L295-L324">https://github.com/oconnor663/duct.rs/blob/17e30e83a16b202551df4d70d0b2cc174cb53e5d/src/lib.rs#L295-L324</a></p>
<p>One more thing I know I wish I didn't</p>



<a name="206010730"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/custom%20rustfmt/near/206010730" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/custom.20rustfmt.html#206010730">(Aug 05 2020 at 11:26)</a>:</h4>
<p>Should be fixed by <a href="https://github.com/rust-analyzer/rust-analyzer/pull/5668">https://github.com/rust-analyzer/rust-analyzer/pull/5668</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>